package com.tdkj.action.backstage.risevalue;

import java.util.List;

import javax.annotation.Resource;

import com.tdkj.action.BaseAction;
import com.tdkj.model.risevalue.BeanFloatColorCustom;
import com.tdkj.service.risevalue.IBeanFloatColorCustomService;

public class FloatColorCustomAction extends BaseAction {
    
	private IBeanFloatColorCustomService floatColorCustomService;
	
	private Long id;
	
	private Integer timeLimitAmount;
	
	private String timeLimitUnit;
	
	private Integer price;
	
	private String unit ;
	
	private List<BeanFloatColorCustom> customs ;
	
	private BeanFloatColorCustom custom ;
	
	private String message;
	
	public String add() {
		custom = new BeanFloatColorCustom();
		custom.setPrice(price);
		custom.setTimeLimitAmount(timeLimitAmount);
		custom.setTimeLimitUnit(timeLimitUnit);
		custom.setUnit(unit);
		
		floatColorCustomService.add(custom);
		this.setMessage("添加成功");
		return execute();
	}
	
	public String update() {
		floatColorCustomService.update(id, timeLimitAmount, timeLimitUnit, price, unit);
		this.setMessage("保存成功");
		return execute();
	}

	public String del() {
		floatColorCustomService.delete(id);
		this.setMessage("删除成功");
		return execute();
	}
	
	public String edit() {
		custom = floatColorCustomService.get(id);
		this.setMessage("获取成功");
		return "edit";
	}
	
	public String get() {
		custom = floatColorCustomService.get(id);
		this.setMessage("获取成功");
		return "get";
	}
	
	public String execute() {
		customs = floatColorCustomService.getAll();
		return "success";
	}
	

	@Resource
	public void setFloatColorCustomService(IBeanFloatColorCustomService floatColorCustomService) {
		this.floatColorCustomService = floatColorCustomService;
	}

	/**
	 * @return the id
	 */
	public Long getId() {
		return id;
	}

	/**
	 * @param id the id to set
	 */
	public void setId(Long id) {
		this.id = id;
	}

	/**
	 * @return the message
	 */
	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public Integer getTimeLimitAmount() {
		return timeLimitAmount;
	}

	public void setTimeLimitAmount(Integer timeLimitAmount) {
		this.timeLimitAmount = timeLimitAmount;
	}

	public String getTimeLimitUnit() {
		return timeLimitUnit;
	}

	public void setTimeLimitUnit(String timeLimitUnit) {
		this.timeLimitUnit = timeLimitUnit;
	}

	public Integer getPrice() {
		return price;
	}

	/**
	 * @param price the price to set
	 */
	public void setPrice(Integer price) {
		this.price = price;
	}

	/**
	 * @return the customs
	 */
	public List<BeanFloatColorCustom> getCustoms() {
		return customs;
	}

	/**
	 * @param customs the customs to set
	 */
	public void setCustoms(List<BeanFloatColorCustom> customs) {
		this.customs = customs;
	}

	/**
	 * @return the custom
	 */
	public BeanFloatColorCustom getCustom() {
		return custom;
	}

	/**
	 * @param custom the custom to set
	 */
	public void setCustom(BeanFloatColorCustom custom) {
		this.custom = custom;
	}

	/**
	 * @return the unit
	 */
	public String getUnit() {
		return unit;
	}

	/**
	 * @param unit the unit to set
	 */
	public void setUnit(String unit) {
		this.unit = unit;
	}

	
}
